package com.example.rocketmqdemo2.demos.web.service;

import com.alibaba.fastjson.JSON;
import com.example.rocketmqdemo2.demos.web.User;

import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.producer.SendCallback;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RocketMQMessageListener(topic = "TopicTest", consumerGroup = "my-consumer_test-topic-2",consumeMode = ConsumeMode.CONCURRENTLY)
public class MQConsumerService implements RocketMQListener<String> {
    @Override
    public void onMessage(String msg) {
        log.info("concurrently consumer get a message. body: {}", msg);
    }
}